#include <vector>
#include <set>
#include <iostream>
#include <unordered_map>
#include <numeric>

using namespace std;

class NumArray{
    public:
        vector<int> sums;
        NumArray(vector<int>& nums);   
        int sumRange(int left, int right);
};

NumArray::NumArray(vector<int>& nums) {
    int n = nums.size();
    sums.resize(n + 1);
    for (int i = 0; i < n; i++) {
        sums[i + 1] = sums[i] + nums[i];
    }
}

int NumArray::sumRange(int left, int right){
    return sums[right + 1] - sums[left];
}

int main(){
    vector<int> nums = {-2, 0, 3, -5, 2, -1};
    NumArray* numArray = new NumArray(nums);
    int param_1 = numArray->sumRange(0, 2);

    return 0;
}